Skip to content

Fixed embedded DM show mode for versioned definitions#1241

Open
philayres wants to merge 4 commits into
consected:developfrom
hmsrc:embedded-versioned-show-mode-1238
Open

Fixed embedded DM show mode for versioned definitions#1241
philayres wants to merge 4 commits into
consected:developfrom
hmsrc:embedded-versioned-show-mode-1238

Conversation

@philayres

@philayres philayres commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1238 — activity log embedded dynamic model items fail to render in read-only (show) mode when the embedded model uses definition versioning.

Root Cause

Two related issues in the Handlebars template config generation:

  1. Alias loop missing version key in app/views/common_templates/_search_results_template.html.erb: When aliasing an embedded dynamic model's template config onto the plural resource name, only the base object was aliased. The browser JS looks up template_config.<resource_name>.v<def_version> — the version-specific key was never copied onto the alias.

  2. Global template missing historical versions in app/views/dynamic_models/_search_results_template.html.erb: The global template (loaded once at page load) only emitted JS config for the current (live) definition version. After a definition version bump, embedded DM records carry an older def_version key that was absent from the global template.

Fix

  • common_templates/_search_results_template.html.erb: The alias loop now also copies the .v<def_version> key onto each alternative resource name.
  • dynamic_models/_search_results_template.html.erb: Now iterates m.all_versions to also emit lightweight JS config blocks for all historical definition versions (Handlebars HTML template re-rendering is skipped for historical versions via the existing unless def_version guard).

Tests

  • Request spec (spec/requests/activity_log/embedded_versioned_template_config_spec.rb): New spec asserting the template_config endpoint correctly aliases the per-version template onto the plural resource name, for both versioned and unversioned embedded dynamic models, including when the embedded record was created under an older definition version.
  • System spec (spec/system/activity_log/embedded_versioned_show_mode_spec.rb): Browser-level acceptance tests covering:
    • Embedded DM items rendered in show mode without version bumps (versioned and unversioned)
    • Embedded DM items still rendered correctly after a definition version bump (pre-bump records use their historical version label)
    • Coexistence of AL records with embedded DMs at different definition versions on the same page

@philayres philayres force-pushed the embedded-versioned-show-mode-1238 branch from 91ac971 to fcc7e16 Compare June 19, 2026 16:40
@philayres philayres changed the title Fix versioned embed template config to show embedded DMs in show mode - fixes #1238 Fixed embedded DM show mode for versioned definitions Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing to show activity log embedded items in show mode

1 participant